草庐IT

c++ - Windows 虚拟键代码

全部标签

winapi - 如何获取windows应用程序的位置和区域(如 "Google Chrome")?

关闭。这个问题需要detailsorclarity.它目前不接受答案。想改进这个问题吗?通过editingthispost添加细节并澄清问题.关闭5年前。Improvethisquestion如何获取pid和Handle,然后获取position?我对此一无所知。请忽略以下代码。packagemainimport("fmt""syscall")funcmain(){iferr:=syscall.Setregid(int(233),int(233));err!=nil{fmt.Println("setregid:",err)}}

windows - 在 go lang 中使用 exec.command 进行网络使用

我需要使用go映射Windows中的驱动器,发现此链接很有用Whatisthebestwaytomapwindowsdrivesusinggolang?当我尝试使用这里给出的代码时,我遇到了这个错误exec:"netuse":executablefilenotfoundin%PATH%我验证了go的bin文件夹在PATH变量中。我也试过像cmd,err:=exec.Command("cmd","/c","NETUSE","T:",\\SERVERNAME\C$,"/PERSISTENT").CombinedOutput()但是我得到这个错误:exitstatus1Youusedanop

go - 作为一个单元测试用例,应该为这样的函数编写什么。代码片段会有所帮助

funcHome(whttp.ResponseWriter,r*staticAuth.AuthenticatedRequest){t,err:=template.ParseFiles("index.html")//parsethehtmlfilehomepage.htmliferr!=nil{//ifthereisanerrorlog.Print("templateparsingerror:",err)//logit}err=t.Execute(w,nil)//executethetemplateandpassittheHomePageVarsstructtofillinthegaps

windows - 如何阻止 Golang 在执行 Windows 命令时用反斜杠替换双引号?

我正在用Golang编写一个程序,它将使用Mozilla的Thunderbird电子邮件客户端发送电子邮件。应该执行的Windows命令是:start"""C:\ProgramFiles(x86)\MozillaThunderbird\thunderbird.exe"-compose"to='CloudCoin@Protonmail.com',subject='Subject1',body='Hello'"-offline我的Go代码看起来像这样(命令是上面列出的那个):varcommandstringcommand=`start"""C:\ProgramFiles(x86)\Mozi

go - 我想知道这段代码中的模式和逻辑

关闭。这个问题需要更多focused.它目前不接受答案。想改进这个问题吗?更新问题,使其只关注一个问题editingthispost.关闭6年前。Improvethisquestion我是Go的新手,所以我需要了解模式并理解这段代码中的逻辑首先:在汽车模型文件夹中有一个.go文件名car.go但它的结构是在Controller文件夹中有一个cars.go文件如下typeCarstruct{Idbson.ObjectId`bson:"_id"`Modelstring`bson:"model"form:""json:"model"binding:"required"`Brandstring

windows - 运行Go文件困难

这个问题在这里已经有了答案:StuckonGoogleHomeTutorial(1个回答)关闭5年前。我卡在了这个教程上。每次我导航到我的文件所在的位置并尝试“gorunpopulationapi.go”步骤时,都没有任何反应。我在我的工作区中创建了一个文件populationapi.go,我已经将其设置为GOPATH变量。我有一台Windows电脑。它应该位于三个文件夹中的哪一个(bin、pkg或src)?关于出了什么问题有什么想法吗?https://www.programmableweb.com/news/how-to-get-started-google-actions/how-

Golang Http 客户端请求在自定义 Http 状态代码上失败

我们正在重写一个旧的集成服务,从python到golang。此服务使用自定义状态代码。例如,状态代码是8000。但是当我试图获得响应时,它给我的错误是“格式错误的HTTP状态代码”。有人可以帮我解决这个问题吗?浏览代码,发现以下代码段在状态代码的长度不是3时抛出错误。iflen(statusCode)!=3{returnnil,&badStringError{"malformedHTTPstatuscode",statusCode}}编辑:我确实了解HTTP状态的RFC标准是3位数字。但我正在重新整合银行系统的遗留代码。所以我不能/没有权限更改服务的实现。为了提供更多上下文,pytho

go - 告诉我这段代码 GOLANG 有什么问题

packagemainimport("fmt""math")funcmain(){distencecalc()}funcdistencecalc(){fmt.Println("X1:")varx1float64fmt.Scanf("%f",&x1)fmt.Print("")fmt.Println("Y1:")vary1float64fmt.Scanf("%f",&y1)fmt.Print("")fmt.Println("Z1:")varz1float64fmt.Scanf("%f",&z1)fmt.Print("")fmt.Println("X2:")varx2float64fmt.S

multithreading - 为什么这段代码没有达到竞争条件?

我有这个go代码,它遍历目录文件树并生成其中每个文件的MD5哈希值,并将结果写入输出文件。packagemainimport("crypto/md5""encoding/hex""fmt""io""os""path/filepath""sync")funcmain(){filePath:=os.Args[1]output:=os.Args[2]wg:=&sync.WaitGroup{}err:=filepath.Walk(filePath,func(pathstring,infoos.FileInfo,errerror)error{if!info.IsDir(){wg.Add(1)go

user-interface - 从一组代码同时打开 2 个相同的窗口

我正在使用以下代码创建并显示一个窗口,其中包含GUI组件作为标签、条目和按钮://modifiedfrom:https://github.com/andlabs/ui/wiki/Getting-Startedpackagemainimport("github.com/andlabs/ui")funcmakewinfn(){varname=ui.NewEntry()varbutton=ui.NewButton("Greet")vargreeting=ui.NewLabel("")box:=ui.NewVerticalBox()box.Append(ui.NewLabel("Enteryo